package cn.wolfcode.trip.base.domain;

import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter @Setter
public class Hotel extends BaseDomain{

    public static final int STATE_NORMAL = 0;
    public static final int STATE_STOP = -1;
    public static final int STATE_COMMEND = 1;

    //酒店名称
    private String name;

    //酒店所在地
    private Region place;

    //酒店封面
    private String coverUrl;

    //酒店介绍
    private String intro;

    //酒店态
    private Integer state=STATE_NORMAL;

    public String getStateName(){
        String temp = "正常";
        if(state == STATE_STOP){
            temp = "禁用";
        }else if(state == STATE_COMMEND){
            temp = "推荐";
        }
        return temp;
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        if(place!=null){
            map.put("placeName",place.getName());
            map.put("placeId",place.getId());
        }

        map.put("coverUrl",coverUrl);
        map.put("state",state);
        return JSONUtils.toJSONString(map);
    }


}